using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class RD_ViewsLinksMap : EntityTypeConfiguration<RD_ViewsLinks>
    {
        public RD_ViewsLinksMap()
        {
            // Primary Key
            this.HasKey(t => new { t.View, t.Object, t.Key });

            // Properties
            this.Property(t => t.View)
                .IsRequired()
                .HasMaxLength(15);

            this.Property(t => t.Object)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.Key)
                .IsRequired()
                .HasMaxLength(9);

            // Table & Column Mappings
            this.ToTable("RD_ViewsLinks");
            this.Property(t => t.View).HasColumnName("View");
            this.Property(t => t.Object).HasColumnName("Object");
            this.Property(t => t.Key).HasColumnName("Key");
        }
    }
}
